
Partial Class UserAdmin
    Inherits System.Web.UI.Page

    Protected Sub ChangePassword_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles ChangePassword.Click

        Dim mu As MembershipUser = Membership.GetUser(UserList.SelectedValue)
        If mu.ChangePassword(OldPassword.Text, NewPassword.Text) Then
            Message.Text = "Password changed"
        Else
            Message.Text = "Password not changed"
        End If

    End Sub

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

        If Not Page.IsPostBack Then
            UserList.DataSource = Membership.GetAllUsers()
            UserList.DataBind()
        End If

    End Sub

    Protected Sub DeleteUser_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles DeleteUser.Click

        Dim u As String = UserList.SelectedValue
        If Membership.DeleteUser(u) Then
            Message.Text = "User " & u & " deleted"
        Else
            Message.Text = "User " & u & " not deleted"
        End If

    End Sub
End Class
